<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('我的预约')" />
</head>
<body class="gray-bg">
     <div class="container-div" id="bcyyorder">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <!--<input th:type="hidden" th:value="${session.name}" name="yuyuerenname">-->
                    <input th:type="hidden" th:value="${session.name}" name="yuyuerenname">
                    <input th:type="hidden" th:value="${session.phone}" name="shoujihao">
                   <!-- <div class="select-list">
                        <ul>
                            <li>
                                <label>预约人：</label>
                                <input type="text"   name="yuyuerenname"/>
                            </li>
                            <li>
                                <label>手机号：</label>
                                <input type="text"   name="shoujihao"/>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>-->
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a id="yuyueButton" class="btn btn-success" href="/system/yuyue/edit">
                    <i class="fa fa-plus"></i> 预约
                </a>
                <a class="btn btn-warning" href="/system/yuyue/index">
                     返回
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var removeFlag = [[${@permission.hasPermi('system:order:remove')}]];
        var prefix = ctx + "system/order";
        function InitSelect(){
            $.ajax({
                type: "post",
                url:  "/system/line/customlist",
                data: {
                },
                success: function(r) {
                    $("#lineid").empty();
                    $("#lineid").append("<option value=''>请选择线路</option>");
                    for (var i = 0; i < r.length; i++) {
                        $("#lineid").append("<option value='" + r[i].lineid + "'>" + r[i].name + "</option>");
                    }
                }
            });
        }

        $(function() {
            getWeekday();

            var options = {
                url: prefix + "/list",
                /*createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",*/
                removeUrl: prefix + "/remove",
                /*exportUrl: prefix + "/export",*/
                modalName: "【班车预约】",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'orderid',
                    title: '预约ID',
                    visible: false
                },
                {
                    field: 'lineid',
                    title: '线路ID',
                    visible: false
                },
                {
                    field: 'banciid',
                    title: '班次ID',
                    visible: false
                },
                {
                    field: 'zhandianid',
                    title: '站点ID',
                    visible: false
                },
                {
                    field: 'linename',
                    title: '线路'
                },
                {
                    field: 'zhandianname',
                    title: '上车点'
                },
                {
                    field: 'yuyuerenname',
                    title: '预约人'
                },
/*                    {
                        field: 'text1',
                        title: '科室'
                    },*/
                {
                    field: 'shoujihao',
                    title: '手机号'
                },
                {
                    field: 'yuyueshijian',
                    title: '预约时间'
                },
                {
                    field: 'bancheshijian',
                    title: '班车时间'
                },

                    /* {
                         field: 'status',
                         title: '状态'
                     },
                         {
                             field: 'text1',
                             title: '状态'
                         },
                         {
                             field: 'text2',
                             title: '状态'
                         },
                         {
                             field: 'text3',
                             title: '状态'
                         },
                         {
                             field: 'text4',
                             title: '状态'
                         },
                         {
                             field: 'text5',
                             title: '状态'
                         },*/
               {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a style="float:right;" class="btn btn-danger btn-xs" onclick="remove(\'' + row.orderid + '\')"><i class="fa fa-remove"></i>删除</a>');
                        /*actions.push('<a class="btn btn-success btn-xs" onclick="YuyueAgain(' + row + ')"><i class="fa fa-edit"></i>再次预约</a> ');*/
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function YuyueAgain(ppRow){
            alert(ppRow.linename);
        }

        function remove(ppId){

            $.ajax({
                type: "post",
                url:  "/system/order/remove",
                data: {
                    "ids": ppId
                },
                success: function(r) {
                    if (r.code == 0) {
                        if (confirm("删除成功")) {
                            location.href = '/system/yuyue/orderlist';
                        }
                    } else {
                        alert(r.msg);
                    }
                }
            });
        }

        function getWeekday() {
            var day = new Date();
            var hour = day.getHours();

            if (hour >= 16) {
                $("#yuyueButton").hide();
            }
        }
    </script>
</body>
</html>